﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NetCoreCMS.IServices;

namespace NetCoreCMS.Web.Areas.WebApi.Controllers
{
    public class Get_BannerController : BaseController
    {
        public IBannerService _banner { get; set; }
        [HttpGet]
        public IActionResult Get()
        {
            var list= _banner.GetList(1, 5, "where status=0 and img_url<>''", "sort_id asc,add_time desc");
            var sysConfig = Common.XMLConfig.Sysconfig.loadConfig(_env.ContentRootPath);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].img_url = sysConfig.weburl + list[i].img_url;
            }
            return Ok(new {status=1, banners = list});
        }
    }
}